<?php
	class MsgManageAction extends CommonAction
	{
		public function index()
		{
			//导入分页类
			import('ORG.Util.Page');
			$count = M('post')->count();	//统计数据库表中的记录数
			$page = new Page($count,5);
			$limit = $page->firstRow.','.$page->listRows;
			
			$post = M('post');
			$wish = $post->order('postdate DESC')->limit($limit)->select();
			$this->assign('wishlist',$wish);
			$this->assign('page',$page->show());
			$this->display();	
		}	
		
		
		//删除数据
		public function delete()
		{
			$id = I('id');
			$result = M('post')->where(array('postid' => $id))->delete();
			if($result>0)
			{
				//echo '成功删除一条ID是：'.$id.' 的数据';	
				$this->success('成功删除一条数据',U('Admin/MsgManage/index'));
			}
			else
			{
				echo '删除数据失败，请重试';	
			}
			
		}
	}
?>